home *** CD-ROM | disk | FTP | other *** search
/ Hyper Stacks 1994 May / Hyper Stacks (Pacific HiTech)(1994)[Mac].iso / MacTools / TC Prog Guide / app ƒ / app.c next >
Encoding:
C/C++ Source or Header  |  1991-01-30  |  2.2 KB  |  80 lines  |  [TEXT/KAHL]

  1. /*
  2. *    FILE:        app.c
  3. *    AUTHOR:        R. Gonzalez
  4. *    CREATED:    August 25, 1990
  5. *
  6. *    Defines generic application methods.
  7. */
  8.  
  9. # ifdef        THINK_C
  10. # include    <oops.h>
  11. # endif
  12.  
  13. # include    <stdlib.h>
  14. # include    "app.h"
  15.  
  16. static boolean    quit(Generic_App*);
  17.  
  18. /************************************************************************
  19. *    initialize application.  Derived abstract application classes
  20. *    should call the inherited init method first in their own inits.
  21. ************************************************************************/
  22. boolean    Generic_App::init(void)
  23. {
  24.     done = FALSE;
  25.     menu = new(Menu);
  26.     menu->init();
  27.     menu->log_command(1,0,"File",NULL);
  28.     menu->log_command(1,1,"Quit",quit);
  29.     
  30.     return TRUE;
  31. }
  32.  
  33. /************************************************************************
  34. *    execute application - this is handled in derived abstract classes
  35. ************************************************************************/
  36. void    Generic_App::run(void)
  37. {
  38. }
  39.  
  40. /************************************************************************
  41. *    get string from user - this is handled in derived abstract classes.
  42. *    All I/O should be accomplished with query() and respond().
  43. ************************************************************************/
  44. void    Generic_App::query(char *question,char answer[])
  45. {
  46. }
  47.  
  48. /************************************************************************
  49. *    reply to user - this is handled in derived abstract classes.
  50. *    All I/O should be accomplished with query() and respond().
  51. ************************************************************************/
  52. void    Generic_App::respond(char *response)
  53. {
  54. }
  55.  
  56. /************************************************************************
  57. *    terminate application.  Derived abstract application classes
  58. *    should call the inherited method.
  59. ************************************************************************/
  60. boolean    Generic_App::destroy(void)
  61. {
  62.     menu->destroy();
  63.     delete(menu);
  64.     
  65.     return TRUE;
  66. }
  67.  
  68. /*------------------------ command functions --------------------------*/
  69.  
  70. /************************************************************************
  71. *    quit - by default the only command available.
  72. ************************************************************************/
  73. boolean    quit(Generic_App *app_ptr)
  74. {
  75.     app_ptr->done = TRUE;
  76.     return TRUE;
  77. }
  78.  
  79.  
  80.